#include "SimpleStates.h"
#include "SimpleHighscoreService.h"
#include "Constants.h"
#include <utils\StringUtils.h>

ScoreState::ScoreState(const std::string& materialName,const std::string& layerName,GameCore* core) 
	: ds::BasicGameState("Scores",materialName,layerName) , m_Core(core) {
	setNextStateName("MainMenu");
	createTextNode("BigText","BigXScale");
	createTextNode("NormalText","XScale");
	addText("BigText",420,180,"Scores");
	addText("BigText",370,250,"Free mode");
	addText("NormalText",260,300,"Easy   (6 colors)");
	addText("NormalText",260,340,"Medium (5 colors)");
	addText("NormalText",260,380,"Hard   (4 colors)");

	m_FMEasy = addText("NormalText",600,340,"0");
	m_FMMedium = addText("NormalText",600,380,"0");
	m_FMHard = addText("NormalText",600,420,"0");
	addText("BigText",370,450,"Rush mode");
	addText("NormalText",220,500,"Easy   (10 seconds)");
	addText("NormalText",220,540,"Medium ( 5 seconds)");
	addText("NormalText",220,580,"Hard   ( 3 seconds)");
	addText("NormalText",140,620,"Press mouse button to return to main menu");
}

bool ScoreState::onActivation() {
	setText("NormalText",m_FMEasy,600,300,ds::string::to_string(m_Core->highscore().getScore(6,0)));
	setText("NormalText",m_FMMedium,600,340,ds::string::to_string(m_Core->highscore().getScore(5,0)));
	setText("NormalText",m_FMHard,600,380,ds::string::to_string(m_Core->highscore().getScore(4,0)));
	return ds::BasicGameState::onActivation();
}
